# 代码所有：cxw
# 开发时间：2021/11/7 15:43

'''在一个模块中存储多个类'''
'''
from car import Elec  #在car.py文件中调用Elec的类，创建一个电动车
my_elec_car=Elec("tes","models",2016)
my_elec_car.get_descriptive_name()
my_elec_car.read_carlength()
my_elec_car.update_long(75)
my_elec_car.increment_odment(5)
my_elec_car.battery.describe()
my_elec_car.battery.battery_length()'''

from car import Car  #从car.py中导入了Car()类，
class Battery():
    def __init__(self,battery_size=85):
        self.battery=battery_size
    def describe(self):
        print("this has ",self.battery," battery!")
    def battery_length(self):
        if self.battery==70:
            range=250
        elif self.battery==85:
            range=245
        mm="this car can go on "+str(range)
        mm+=" miles on a full charge."
        print(mm)
class Elec(Car):
    def __init__(self,make,model,year):
        super(Elec, self).__init__(make,model,year)
        self.battery=Battery()
